﻿@model IEnumerable<benefit.Models.Group>
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript">
    $(function () {
        $("[name='Delete']").click(
        function () {
            if (confirm("确定要删除这条记录么？")) {
                var stuid = $(this).attr("stuid");
                var tr = $(this).parent().parent();
                $.post("/GroupShow/Delete/", { id: stuid }, function (data) {
                    if (data == "-1") {
                        alert("删除失败");
                    } else {
                        $(tr).remove();
                        alert("删除成功");
                    }
                }
              );
            }
        }
        );
    });
</script>
<dl id="xiangmu">
    <dt><span id="title2">小组列表</span></dt>
</dl>
<div style="text-align: right; padding-right: 8%;">@Html.ActionLink("新增小组", "Create")</div>
<div align="center">
    <table cellspacing="0" cellpadding="0" class="list" style="width: 90%;">
        <tr>
            <td style="text-align: left; padding-left: 10px;" class="title">
                小组名称
            </td>
            <td style="text-align: left; padding-left: 10px;" class="title">
                父小组
            </td>
            <td style="text-align: left; padding-left: 10px;" class="title">
                操作
            </td>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td style="text-align: left; padding-left: 10px;">
                    @Html.DisplayFor(modelItem => item.GroupName)
                </td>
                <td style="text-align: left; padding-left: 10px;">
                    @Html.DisplayFor(modelItem => item.ParentGroup.GroupName)
                </td>
                <td style="text-align: left; padding-left: 10px;">
                    @Html.ActionLink("修改", "Edit", new { id = item.Id }) |
                    @Html.ActionLink("查看", "Details", new { id = item.Id }) | <a  name="Delete" stuid="@item.Id" style=" cursor:pointer;">
                        删除</a>
                </td>
            </tr>
        }
    </table>
</div>
